package com.gui.spring.aop.base;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Aspect
@Component
public class AuthAspect {

    @Around("execution(* com.gui.spring.aop.base.Service01.foo(..))")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] args = joinPoint.getArgs();
        System.out.println("环绕前置，打印入参：" + Arrays.toString(args));
        Object result = joinPoint.proceed();
        System.out.println("环绕后置，打印返回值：" + result);
        return result;
    }
}
